<script lang="ts" setup>
import {ref} from 'vue'
import DataForm from "@/components/data-form/index.vue";

const dataFormRef = ref<InstanceType<typeof DataForm>>();
const disabled = ref(false);
const forms = ref([
    {prop: 'id'},
    {prop: 'name', label: '名称', required: true, attrs: {placeholder: '文件库名称'}},
    {prop: 'path', label: '路径', required: true, attrs: {placeholder: '存储路径，例如：D:/home（windows系统） 或者 /home（linux系统）'}, disabled: disabled},
    {prop: 'maxLimit', label: '阈值', attrs: {placeholder: '达到阈值时切换存储目录(默认：100),修改后下次切换目录生效'}},
    {prop: 'description', label: '描述', attrs: {type: 'textarea', resize: 'none', rows: 6}},
])


const open = (options: OpenFormConfig) => {
    disabled.value = !!options.data
    dataFormRef.value?.open(options);
}

defineExpose({open})
</script>
<template>
    <data-form ref="dataFormRef" :forms="forms" description="文件库"/>
</template>